﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Runtime.InteropServices;
using System.Text;
using System.Threading.Tasks;

namespace VSHT.sdk
{
    class ZAZApi
    {
        [DllImport("ZAZAPIK.dll", EntryPoint = "ZAZOpenDeviceEx")]
        public static extern int openDeviceEx(ref IntPtr pHandle, int nDeviceType, int iCom, int iBaud, int nPackageSize, int iDevNum);

        [DllImport("ZAZAPIK.dll", EntryPoint = "ZAZCloseDeviceEx")]
        public static extern int closeDeviceEx(IntPtr pHandle, UInt32 nAddr);

        [DllImport("ZAZAPIK.dll", EntryPoint = "ZAZInitConnect")]
        public static extern int initConnnect(IntPtr pHandle, UInt32 nAddr);

        [DllImport("ZAZAPIK.dll", EntryPoint = "ZAZGETIMAGE")]
        public static extern int getImage(IntPtr hHandle, UInt32 nAddr);

        [DllImport("ZAZAPIK.dll", EntryPoint = "ZAZUPIMAGE")]
        public static extern int upImage(IntPtr hHandle, UInt32 nAddr, byte[] bbmpbuf, int[] bmpwidth, int[] bmpheigh);

        [DllImport("ZAZAPIK.dll", EntryPoint = "ZAZGenChar")]
        public static extern int genChar(IntPtr hHandle, UInt32 nAddr, int setvalue);

        [DllImport("ZAZAPIK.dll", EntryPoint = "ZAZDownChar")]
        public static unsafe extern int downChar(IntPtr hHandle, uint nAddr, int buffer, byte[] Template, IntPtr* tlen);

        [DllImport("ZAZAPIK.dll", EntryPoint = "ZAZUpChar")]
        public static unsafe extern int upChar(IntPtr hHandle, UInt32 nAddr, int buffer, byte[] Template, IntPtr* tlen);


        [DllImport("ZAZAPIK.dll", EntryPoint = "ZAZMergeChar")]
        public static extern int mergeChar(IntPtr hHandle, UInt32 nAddr, int buffer, int mode);


        [DllImport("ZAZAPIK.dll", EntryPoint = "ZAZGETSN")]
        public static extern int getSN(IntPtr hHandle, UInt32 nAddr, int[] SNstr);

        [DllImport("ZAZAPIK.dll", EntryPoint = "ZAZErr2Str")]
        public static extern string ZAZErr2Str(int nErrCode);

        [DllImport("ZAZAPIK.dll", EntryPoint = "ZAZFINGERDETECT")]
        public static unsafe extern int fingerDetect(IntPtr hHandle, uint nAddr);

        [DllImport("ZAZAPIK.dll", EntryPoint = "ZAZStoreChar")]
        public static extern int storeChar(IntPtr hHandle, uint nAddr, int buffer, int storeid);

        [DllImport("ZAZAPIK.dll", EntryPoint = "ZAZGETEMPTYID")]
        public static unsafe extern int getEmptyId(IntPtr pHandle, uint nAddr, int startid, int endid, IntPtr* getid);

        [DllImport("ZAZAPIK.dll", EntryPoint = "ZAZDelChar")]
        public static extern int delChar(IntPtr hHandle, uint nAddr, int startid, int endid);

        [DllImport("ZAZAPIK.dll", EntryPoint = "ZAZErr2Str")]
        public static unsafe extern IntPtr err2str(int nErrCode);

        [DllImport("ZAZAPIK.dll", EntryPoint = "ZAZSearch")]
        public static unsafe extern int search(IntPtr pHandle, uint nAddr, int startid, int endid, int buffer, IntPtr* fpno);

        [DllImport("ZAZAPIK.dll", EntryPoint = "ZAZLoadChar")]
        public static extern int loadChar(IntPtr phHandle, uint nAddr, int buffer, int storeid);
    }
}
